

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

class SingleChildScrollViewDemo extends StatelessWidget {
  const SingleChildScrollViewDemo({super.key});

  @override
  Widget build(BuildContext context) {
    return Stack(
      children: [
        SingleChildScrollView(
          scrollDirection: Axis.horizontal,
          child: Row(
            children: [
              OutlinedButton(
                onPressed: () {},
                style: ButtonStyle(
                    textStyle: MaterialStateProperty.all(TextStyle(fontSize: 16)),
                ),
                child: const Text('轮廓按钮1'),
              ),
              OutlinedButton(
                onPressed: () {},
                style: ButtonStyle(
                  textStyle: MaterialStateProperty.all(TextStyle(fontSize: 16)),
                ),
                child: const Text('轮廓按钮2'),
              ),
              OutlinedButton(
                onPressed: () {},
                style: ButtonStyle(
                  textStyle: MaterialStateProperty.all(TextStyle(fontSize: 16)),
                ),
                child: const Text('轮廓按钮3'),
              ),
              OutlinedButton(
                onPressed: () {},
                style: ButtonStyle(
                  textStyle: MaterialStateProperty.all(TextStyle(fontSize: 16)),
                ),
                child: const Text('轮廓按钮4'),
              ),
            ],
          ),
        ),
        SingleChildScrollView(
          scrollDirection: Axis.vertical,
          reverse: true, // 是否从底部开始滚动
          physics: const BouncingScrollPhysics(), /* 弹性下拉效果 */
          child: Column(
            children: List.generate(30, (idx) => OutlinedButton(
              onPressed: () {},
              style: ButtonStyle(
              textStyle: MaterialStateProperty.all(TextStyle(fontSize: 16))),
              child: Text('轮廓按钮$idx'),
              ),
            )
          ),
        )
      ],
    );
  }

}